package com.mit.service.design.dao.impl;

import java.util.HashMap;
import java.util.List;

import com.mit.common.design.dto.StyleColorDTO;
import com.mit.common.maintenance.dto.ProductColorDTO;
import com.mit.service.core.dao.AbstractDAO;
import com.mit.service.design.dao.IStyleColorDAO;

public class StyleColorDAOImpl extends AbstractDAO implements IStyleColorDAO {

	@Override
	public StyleColorDTO createStyleColor(StyleColorDTO to) {
		int id = (Integer) getSqlMapClientTemplate().insert("insertStyleColor", to);
		to.setId(id);
		return to;
	}



	@Override
	public void deleteColor(int styleId, int colorId) {
		HashMap map = new HashMap();
		map.put("styleId", styleId);
		map.put("colorId", colorId);
		
		getSqlMapClientTemplate().delete("deleteStyleColor", map);
		
	}

	@Override
	public List<ProductColorDTO> retrieveColors(int styleId) {
		
		return  (List<ProductColorDTO>) getSqlMapClientTemplate().queryForList("selectColorsByStyle", styleId);
	}

}
